<?php 
if(!isset($_SESSION))
    session_start();
class mailler extends CI_Controller  {

        /**
        * Index Page for this controller.
        *
        * Maps to the following URL
        * 		http://example.com/index.php/welcome
        *	- or -  
        * 		http://example.com/index.php/welcome/index
        *	- or -
        * Since this controller is set as the default controller in 
        * config/routes.php, it's displayed at http://example.com/
        *
        * So any other public methods not prefixed with an underscore will
        * map to /index.php/welcome/<method_name>
        * @see http://codeigniter.com/user_guide/general/urls.html
        */
       
       function __construct()
        {
            parent::__construct();
            require ( APPPATH . 'libraries/phpmailer/class.phpmailer.php' );
            
        }
        public function index(){
            show_404();
        }
        public function MailTo($sEmail="",$sName="You",$sSubject="",$sBody=""){
            //$sEmail = ' khuongxuantruong@gmail.com '; // dia chi email se nhan mail 
            //$sName = 'KXT';// ten nguoi nhan
            $sEmailSender = 'noreply@dealgiadung.com';// dia chi email cua nguoi goi 
            $sSenderName ='Dealgiadung'; // Tên Người Gửi
            $sHost ='mail.dealgiadung.com'; //Host
            $sUser ='noreply@dealgiadung.com';// Tài Khoản Người gửi
            $sPass ='b0c057f0a715e648ac5dba9acf9c0ea6@THAILONG';// Mật Khẩu Tài Khoản Email
            //$sSubject =$sSubject; //Tiêu Đề Email
            //$sBody = $sBody; //Nội Dung Thư
            $mail = new PHPMailer();
            $mail->CharSet="utf-8";
            $mail->IsSMTP(); 
            $mail->Host = $sHost ; 
            $mail->Port="26";
            $mail->SMTPAuth = true; 
            $mail->Username = $sUser ; 
            $mail->Password = $sPass; 
            $mail->From = $sEmailSender;//$sEmailSender; 
            $mail->FromName = $sSenderName;//$sSenderName; 
            $mail->AddAddress($sEmail,$sName); 
            //$mail->AddReplyTo($sEmailSender,$sSenderName); 
            $mail->WordWrap = 50; 
            $mail->IsHTML(true); 
            $mail->Subject = $sSubject; 
            $mail->Body = $sBody; 
            $mail->AltBody = ""; 
            if(!$mail->Send()){ 
                //print $mail->ErrorInfo; 
                return false;
            }else{ 
                return true;
            }
        }
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */